#ifndef SQUARE_H
#define SQUARE_H

/*!
 * \file     square.h
 * \brief    Abstract Square.
 *
 *           This class is the mother of all kind of Square.
 *
 * \author   Duriez Franck
 * \author   Carton Paul-Henri
 * \version  0.1
 */

#include "drawable.h"
#include "squarecontainer.h"
#include "action.h"

class SquareContainer;

/*!
 * \class Square
 * \brief Abstract Square.
 *
 * This class is the mother of all kind of Square.
 */
class Square : public Drawable /*{{{*/
{
	Q_OBJECT
/*{{{*/
public:
	/*!
	 * \brief Constructor.
	 * \param displayWidget : displayer
	 * \param dt            : pointer to the infinitesimal part of time
	 */
	Square(QSFMLWidget* displayWidget, float* dt);

	/*!
	 * \brief Destructor.
	 */
	virtual ~Square();

signals:
	void isDead(Vector2i coord);

protected:
	SquareContainer* m_container;
	Vector2i m_position_in_container;
/*}}}*/

	/************
	 * DRAWABLE *
	 ************/
/*{{{*/
public:
	void update();

	std::string toString() const;
/*}}}*/

	/***********
	 * ACTIONS *
	 ***********/
/*{{{*/
public:
	Action<Square> destroy;

private:
	virtual void destroyStartingProcess() = 0;
	virtual void destroyProcess() = 0;
	void         destroyDefaultStoppingProcess();
	virtual void destroyStoppingProcess() = 0;
/*}}}*/

	/*************
	 * CONTAINER *
	 *************/
/*{{{*/
	friend class SquareContainer;

protected:
	SquareContainer* getContainer();
	void setContainer(SquareContainer* container);
	void setPositionInContainer(Vector2i coord);
	Vector2i getPositionInContainer() const;
/*}}}*/
}; /*}}}*/

#endif // SQUARE_H
